package com.situ.mall.common.mapper;

import com.situ.mall.common.entity.Category;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.situ.mall.common.vo.CategoryVO;
import com.situ.mall.common.vo.IndexCategoryVO;
import com.situ.mall.common.vo.IndexProductVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lwj
 * @since 2023-09-11
 */
public interface CategoryMapper extends BaseMapper<Category> {
    List<CategoryVO> tree();
    @Select("select * from category where parent_id = #{parentId}")
    List<CategoryVO> selectByParentId(Integer id);


    @Delete("delete from category where id = #{id}")
    void delete(Integer id);

    List<IndexCategoryVO> indexList();

    @Select("select * from category where parent_id = #{parentId} limit 0,4")
    List<Category> select4(Integer parentId);

    @Select("select * from category where parent_id = #{parentId} limit 0,1")
    List<Category> select1(Integer parentId);

//    List<IndexCategoryVO> tree2();

}
